@echo on
@REM Cleanup unnecessery files 
@REM @author lance.liao@cygia.com

echo Cleanup files of output
DEL /F/S .\x64\*.iobj
DEL /F/S .\x64\*.exp
DEL /F/S .\x64\*.ilk
DEL /F/S .\x64\Release\*.ipdb
DEL /F/S .\x64\Release\*.idb

echo Cleanup object files...
for /d %%d in (*.*) do (
	IF %%d=="x64" continue
	 if "%%d" EQU "x64" (
		echo "ignore %%d"
	  ) else ( 
		rd %%d\x64 /s /q 
		rd %%d\bin /s /q 
		rd %%d\Debug /s /q 
		rd %%d\Release /s /q 
		rd %%d\obj /s /q 
		rd %%d\logs /s /q 
		del %%d\*.log /s /q 
		del %%d\*.ilk /s /q 
		del %%d\*.aps /s /q 
		del %%d\*.user /s 
		del %%d\BuildInfo.hpp /s 
	  )
)

IF "%1"=="all" GOTO CLEANALL
GOTO FINISH

:CLEANALL
echo Cleanup output files...
rd .\x64 /s /q

echo Cleanup build lib...
rd .\SharedLibs\CygiaSocket /s /q
rd .\SharedLibs\FilterSDK /s /q

:FINISH
rd .\ipch /s /q
rd .\bin /s /q
rd .\Debug /s /q
rd .\Release /s /q
del .\*.db
del .\*.idb
del .\*.opendb

echo Done!

@pause